package com.ikproducts.manualian.server;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.jdo.annotations.Extension;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;
import com.google.appengine.api.datastore.Key;
import com.ikproducts.manualian.client.MD5;

@PersistenceCapable(identityType = IdentityType.APPLICATION, detachable="true")
public class Article {
	
	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	@Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value = "true")
	private String key;

	@Persistent
	private
	String _UserName;
	
	@Persistent
	private	String _UserNameMD5;
	
	@Persistent
	private String _Title;

	@Persistent
	private String _CategoryPathOfDisplayName;

	@Persistent
	private String _CategoryPathOfIDName;
	
	@Persistent
	private int _CategoryID;

	@Persistent(defaultFetchGroup = "true")
	private List<String> _BriefOfUpdates;

		
	@Persistent(defaultFetchGroup = "true")
    private List<Content> _Contents;
	/*		
	@Persistent(defaultFetchGroup = "true")
	private List<Date> _DateOfUpdates;
	
	@Persistent(defaultFetchGroup = "true")
	private List<String> _BriefOfUpdates;
	
	@Persistent
	private Date _DateOfCreate;

	@Persistent
	private boolean _IsPublic = true;

	@Persistent(defaultFetchGroup = "true")
	List<String> _MemberOfShare;
*/	
	public Article(String userName, String title, List<Content> contents, String categoryPathOfDiplayName, String categoryPathOfIDName, int categoryID){
		set_UserName(userName);
		set_UserNameMD5(MD5.get(userName));
		set_Title(title);
		set_Contents(contents);
		set_CategoryPathOfDisplayName(categoryPathOfDiplayName);
		set_CategoryPathOfIDName(categoryPathOfIDName);
		set_CategoryID(categoryID);
		List<String> list = new ArrayList<String>();
		list.add("takeshi");
		list.add("samma");
		set_BriefOfUpdates(list);		
	}

	public void set_UserName(String _UserName) {
		this._UserName = _UserName;
	}

	public String get_UserName() {
		return _UserName;
	}

	public void set_UserNameMD5(String _UserNameMD5) {
		this._UserNameMD5 = _UserNameMD5;
	}

	public String get_UserNameMD5() {
		return _UserNameMD5;
	}

	public void set_Title(String _Title) {
		this._Title = _Title;
	}

	public String get_Title() {
		return _Title;
	}

	public void set_CategoryPathOfDisplayName(String _CategoryPathOfDisplayName) {
		this._CategoryPathOfDisplayName = _CategoryPathOfDisplayName;
	}

	public String get_CategoryPathOfDisplayName() {
		return _CategoryPathOfDisplayName;
	}

	public void set_CategoryPathOfIDName(String _CategoryPathOfIDName) {
		this._CategoryPathOfIDName = _CategoryPathOfIDName;
	}

	public String get_CategoryPathOfIDName() {
		return _CategoryPathOfIDName;
	}

	public void set_CategoryID(int _CategoryID) {
		this._CategoryID = _CategoryID;
	}

	public int get_CategoryID() {
		return _CategoryID;
	}


	public void set_Contents(List<Content> _Contents) {
		this._Contents = _Contents;
	}

	public List<Content> get_Contents() {
		return _Contents;
	}
	/*
	public void set_DateOfUpdates(List<Date> _DateOfUpdates) {
		this._DateOfUpdates = _DateOfUpdates;
	}

	public List<Date> get_DateOfUpdates() {
		return _DateOfUpdates;
	}

	public void set_BriefOfUpdates(List<String> _BriefOfUpdates) {
		this._BriefOfUpdates = _BriefOfUpdates;
	}

	public List<String> get_BriefOfUpdates() {
		return _BriefOfUpdates;
	}

	public void set_DateOfCreate(Date _DateOfCreate) {
		this._DateOfCreate = _DateOfCreate;
	}

	public Date get_DateOfCreate() {
		return _DateOfCreate;
	}

	public void set_IsPublic(boolean _IsPublic) {
		this._IsPublic = _IsPublic;
	}

	public boolean is_IsPublic() {
		return _IsPublic;
	}
*/

	public void set_BriefOfUpdates(List<String> _BriefOfUpdates) {
		this._BriefOfUpdates = _BriefOfUpdates;
	}

	public List<String> get_BriefOfUpdates() {
		return _BriefOfUpdates;
	}

}
